<%@page import="java.util.ArrayList"%>
<%@ page  contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>표현 언어 Expression Language</title>
</head>
<body>
<h1>표현 언어 Expression Language</h1>
<h3>개요</h3>
<p> JSP2.0부터 지원, 스크립트릿 없는 JSP작성을 위해 탄생</p>
<h3>EL리터럴 표현</h3>
<p>${"가나다"}</p>
<p>${'xyz'}</p>
<p>${123 }</p>
<p>${987.65 }</p>
<p>${true }</p>
<p>${null}</p>

<h3>EL연산자</h3>
<p>산술: +,-,*,div, mod</p>
<p>논리: and, or, not</p>
<p>관계: eq, ne, lt, gt, le, ge</p>
<p>empty, not empty</p>
<hr/>
<p>1>(4/2): ${1>(4/2)}</p>
<p>${4.0 ge 3 }</p>
<p>100.0 eq 100: ${100.0 eq 100 }</p>
<p>(10*10) ne 100 : ${(10*10) ne 100 }</p>
<p>'a'lt'b': ${'a'lt'b'}</p>
<p>'hip' gt 'hit': ${'hip' gt 'hit'}</p>
<p>4 gt 3 : ${4 gt 3 }</p>
<p>1.2e4 + 1.4: ${1.2e4 + 1.4 }</p>
<p>3 div 4: ${3 div 4}</p>
<p>10 mod 4: ${10 mod 4}</p>

<h3>객체 다루기</h3>
<p>EL로 다룰 수 있는 객체의 종류는 크게 4가지</p>
<p>자바 빈즈 JavaBeans</p>
<p>콜렉션 Collection</p>
<p>열거형 Enum object</p>
<p>내장객체 implicit object</p>


<%String obj1 = "Hello, EL!!"; %>
<p>String obj1:${obj1}</p>
<jsp:useBean id="sj" class="jech913.sungjuk.SungJukVO" />
<jsp:setProperty name="sj" property="name" value="수지" />
<p>SungJukVO빈즈의 name속성: ${sj.name}</p>

<%ArrayList member = new ArrayList();
  member.add("수지");
  member.add("혜교");
  member.add("지현");
  pageContext.setAttribute("member", member);
  %>
  <p>Member List: ${member[0]},${member[1]},${member[2]} </p>
  
  <p>클라이언트 주소:${pageContext.request.remoteAddr}</p>
  <p>클라이언트 주소:<%=request.getRemoteAddr() %></p>
  <p>호스트 이름: ${header["host"]}</p>
  <p>서블릿 실행경로: ${requestScope['javax.servlet.forward.servlet_path']}</p>
</body>
</html>